var domainString = (window.location != window.parent.location)?document.referrer.split("/")[2]:document.location.href.split("/")[2]; var refererurl_MTc2Nw = document.referrer.split("/")[2]; var cururl_MTc2Nw = document.location.href.split("/")[2]; var isiframe_MTc2Nw = window.location!=window.parent.location; var tp_MTc2Nw = "script"; var dcamp_doc_MTc2Nw=(isiframe_MTc2Nw==true && refererurl_MTc2Nw==cururl_MTc2Nw && tp_MTc2Nw != "script") ? parent.document || top.document : document; var dcamp_win_MTc2Nw=(isiframe_MTc2Nw==true && refererurl_MTc2Nw==cururl_MTc2Nw) ? window.parent.parent || window.parent || window.top : window; //console.log(dcamp_doc_MTc2Nw.location.href); //console.log(isiframe_MTc2Nw, refererurl_MTc2Nw, cururl_MTc2Nw); //console.log(Object.keys(dcamp_win_MTc2Nw)); function addListener_MTc2Nw(target, type, handler) { if (target.addEventListener) { target.addEventListener(type, handler, false); } else if (target.attachEvent) { target.attachEvent("on" + type, handler); } else { target["on" + type] = handler; } } function elementInViewport_MTc2Nw(el) { var rect = el.getBoundingClientRect(); if (typeof rect.width === 'undefined') { return false; } else { return (rect.top>=0 && rect.left>=0 && rect.top <= (dcamp_win_MTc2Nw.innerHeight - 50 || dcamp_doc_MTc2Nw.documentElement.clientHeight - 50)); } } function imp_tracking_MTc2Nw(tp){ if(tp=='iframe') { var id_selector1 = dcamp_doc_MTc2Nw.getElementById("digitalcamp_MTc2Nw"); } else if(tp=='script') { var id_selector1 = dcamp_doc_MTc2Nw.getElementById("dcamp_ad_1767"); } if(typeof id_selector1 === 'undefined' || id_selector1 === null) return; if(elementInViewport_MTc2Nw(id_selector1)) { if(tp=='iframe') { var id_selector2 = dcamp_doc_MTc2Nw.getElementById("digitalcamp_MTc2Nw").contentWindow.document.getElementById("dcamp_imptrack_1767"); var id_selector3 = dcamp_doc_MTc2Nw.getElementById("digitalcamp_MTc2Nw").contentWindow.document.getElementById("dcamp_third_track_1767"); } else if(tp=='script') { var id_selector2 = dcamp_doc_MTc2Nw.getElementById("dcamp_imptrack_1767"); var id_selector3 = dcamp_doc_MTc2Nw.getElementById("dcamp_third_track_1767"); } if(typeof id_selector2 === 'undefined' || id_selector2 === null) return; var imgurl = id_selector2.getAttribute('data-src'); if(imgurl){ id_selector2.src = imgurl; is_tracking_MTc2Nw = true; if(typeof id_selector3 !== 'undefined' && id_selector3 !== null) { var imgurl2 = id_selector3.getAttribute('data-src'); if(imgurl2) id_selector3.src = imgurl2; } } } } function loadAdContent_MTc2Nw(mo, mc, tp, wi, he, ps, purl, bt, ac) { var load = false; var rect = new Array(); var edata = new Array(); var viewClientHeight = 0; var isdiv = false; var aptcode_txt = (ac!='')?'&aptcode='+ac:''; var windowScroll_MTc2Nw = function(){ clearTimeout(reloadTimer_MTc2Nw); if(!load){ var isIE=(/(?:MSIE |Trident\/.*; rv:)(\d+)/.exec(navigator.userAgent))?Number(RegExp.$1):0; if(tp=='iframe') { var source = mo.getAttribute('data-src'); var temp_source = source.split('&'); var source_result=""; for ( var i in temp_source ) { source_result = source_result + ((i==0)?'':'&') + temp_source[i]; if(i==0) source_result = source_result + '&tp=' + tp + '&ie=' + isIE; } mo.src = source_result; load=true; is_tracking_MTc2Nw=true; } else if(tp=='script') { var c_wi = (wi.indexOf('%') != -1) ? wi : wi+'px'; var c_he = (he.indexOf('%') != -1) ? he : he+'px'; var height_txt = (wi.indexOf('%') == -1 && he != "") ? 'height:'+c_he+';' : ''; if(!isdiv){ if (typeof cont_MTc2Nw === 'undefined' || typeof cont_num_MTc2Nw === 'undefined') { //단락 및 단락번호가 없을시는 미리 div를 선언하여 스크립트 배포함 } else { //단락 및 단락번호가 있을시는 검색후에 div를 생성함 var innerTag = '
'; var cnum = (cont_num_MTc2Nw) ? cont_num_MTc2Nw : 0; var media_selector = dcamp_doc_MTc2Nw.querySelectorAll(cont_MTc2Nw)[cnum]; if(typeof media_selector === 'undefined') return; media_selector.insertAdjacentHTML('beforebegin',innerTag); } isdiv = true; } var id_selector = dcamp_doc_MTc2Nw.getElementById("dcamp_ad_1767"); if(typeof id_selector === 'undefined') return; if(isiframe_MTc2Nw==false){ var so = dcamp_doc_MTc2Nw.createElement('script'); so.setAttribute('src', 'https://tracker.digitalcamp.co.kr/?'+mc+'&tp=script&w='+wi+'&h='+he+'&ps='+ps+'&bt='+bt+'&ie='+isIE+aptcode_txt+'&v=2&url='+purl); dcamp_doc_MTc2Nw.getElementsByTagName('head')[0].appendChild(so); load=true; } else { var ifr = document.createElement('iframe'); ifr.setAttribute('id','dcamp_iframe_1767'), ifr.setAttribute('frameborder','0'), ifr.setAttribute('allowtransparency','true'), ifr.setAttribute('hspace','0'), ifr.setAttribute('marginwidth','0'), ifr.setAttribute('marginheight','0'), ifr.setAttribute('scrolling','no'), ifr.setAttribute('vspace','0'), ifr.setAttribute('width', wi), ifr.setAttribute('height', he); id_selector.appendChild(ifr); var htmlcode = '
'; var ifrd = ifr.contentWindow.document; ifrd.open(); ifrd.write(htmlcode); ifrd.close(); load=true; is_tracking_MTc2Nw=true; } } if(load){ setTimeout('imp_tracking_MTc2Nw("'+tp+'")',3000); } } else { if(!is_tracking_MTc2Nw){ imp_tracking_MTc2Nw(tp); } } processMessage(); }; var processMessage = function(){ //스크롤시 iframe 내부에 이벤트값 보내기 if(mo !== null && typeof mo !== 'undefined'){ viewClientHeight = dcamp_win_MTc2Nw.innerHeight || dcamp_doc_MTc2Nw.documentElement.clientHeight || dcamp_doc_MTc2Nw.body.clientHeight; edata.top = id_MTc2Nw.getBoundingClientRect().top; edata.viewClientHeight = viewClientHeight; mo.contentWindow.postMessage(edata, "*"); return true; } //같은 매체 도메인이고 iframe안에 스크립트를 감싸고 있을때 if(mc == "NjMy"){ //국민일보 PC 동영상 관련 예외처리 2020-04-21 var m_iframe_MTc2Nw = dcamp_win_MTc2Nw.document.getElementById('subIframe'); } else { var m_iframe_MTc2Nw = dcamp_win_MTc2Nw.document.getElementById('dcamp_iframe_1767'); } if(m_iframe_MTc2Nw !== null && typeof m_iframe_MTc2Nw !== 'undefined' && isiframe_MTc2Nw==true && refererurl_MTc2Nw==cururl_MTc2Nw){ viewClientHeight = m_iframe_MTc2Nw.innerHeight; if(mc == "NjMy"){ edata.top = m_iframe_MTc2Nw.getBoundingClientRect().top + 550; } else { edata.top = m_iframe_MTc2Nw.getBoundingClientRect().top; } edata.viewClientHeight = dcamp_win_MTc2Nw.innerHeight; m_iframe_MTc2Nw.contentWindow.postMessage(edata, "*"); return true; } //script형태이면서 상위 iframe이 존재할때(ADOP 연동 추가 - 2021.02.17) var pm_selector = dcamp_doc_MTc2Nw.getElementById("dcamp_iframe_1767"); if(typeof pm_selector === 'undefined') return; if(pm_selector !== null && typeof pm_selector !== 'undefined' && isiframe_MTc2Nw==true && refererurl_MTc2Nw==cururl_MTc2Nw && tp_MTc2Nw == "script"){ viewClientHeight = dcamp_win_MTc2Nw.innerHeight || dcamp_doc_MTc2Nw.documentElement.clientHeight || dcamp_doc_MTc2Nw.body.clientHeight; var selector = dcamp_win_MTc2Nw.document.querySelector('[id^="ADOP_V_"]'); if(selector === null || typeof selector === 'undefined') return; edata.top = selector.getBoundingClientRect().top; edata.viewClientHeight = viewClientHeight; pm_selector.contentWindow.postMessage(edata, "*"); return true; } } windowScroll_MTc2Nw(); addListener_MTc2Nw(dcamp_win_MTc2Nw, 'scroll', windowScroll_MTc2Nw); } //window 객체가 없을때 iframe형태로 노출 var check_mc = 'MTc2Nw'; //레인보우8 뉴시스 예외처리 if(check_mc == "ODc5" || check_mc == "MTcxNA"){ var mc = 'MTc2Nw'; var wi = '160'; var he = '600'; var ps = ''; var purl = '%7BINSERT+PASSBACK+URL%7D'; var bt = ''; var isIE=(/(?:MSIE |Trident\/.*; rv:)(\d+)/.exec(navigator.userAgent))?Number(RegExp.$1):0; var ac = ''; var aptcode_txt = (ac!='')?'&aptcode='+ac:''; var id_selector = dcamp_doc_MTc2Nw.getElementById("dcamp_ad_1767"); if(typeof id_selector === 'undefined') exit; var ifr = document.createElement('iframe'); ifr.setAttribute('id','dcamp_iframe_1767'), ifr.setAttribute('frameborder','0'), ifr.setAttribute('allowtransparency','true'), ifr.setAttribute('hspace','0'), ifr.setAttribute('marginwidth','0'), ifr.setAttribute('marginheight','0'), ifr.setAttribute('scrolling','no'), ifr.setAttribute('vspace','0'), ifr.setAttribute('width', wi), ifr.setAttribute('height', he); id_selector.appendChild(ifr); var htmlcode = '
'; var ifrd = ifr.contentWindow.document; ifrd.open(); ifrd.write(htmlcode); ifrd.close(); } else { var is_tracking_MTc2Nw=false; var id_MTc2Nw=dcamp_doc_MTc2Nw.getElementById("digitalcamp_MTc2Nw"); var reloadTimer_MTc2Nw; loadAdContent_MTc2Nw(id_MTc2Nw, "MTc2Nw", "script", "160", "600", "", "%7BINSERT+PASSBACK+URL%7D", "", ""); //console.log(typeof dcamp_win_MTc2Nw === 'undefined' || dcamp_win_MTc2Nw === null); }